﻿
/*******************************************************************************************
// ©2009 Microsoft Corporation.  This code is provided under the Microsoft Public License.
*******************************************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace ClientBilling
{
    /// <summary>
    /// Represents a single case belonging to a client.
    /// </summary>
    [Serializable]
    public class Case
    {
        public string Number { get; set; }
        public string Description { get; set; }
        public string Notes { get; set; }
        public Client Client { get; set; }

        public Case() { }

        public Case(string number, string description, Client client)
        {
            Number = number;
            Description = description;
            Client = client;
        }

        public string FullName
        {
            get
            {
                if (string.IsNullOrEmpty(Number) && string.IsNullOrEmpty(Description))
                {
                    return string.Empty;
                }
                else if (string.IsNullOrEmpty(Number))
                {
                    return string.Format("Case: {0}", Description);
                }
                else if (string.IsNullOrEmpty(Description))
                {
                    return string.Format("Case {0}", Number);
                }
                else
                {
                    return string.Format("Case {0}: {1}", Number, Description);
                }
            }
        }

        public override string ToString()
        {
            return this.FullName;
        }
    }
}
